package com.lw;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.net.InetAddress;
import java.net.UnknownHostException;

@MapperScan("com.lw.mapper")
@EnableScheduling
@SpringBootApplication
@EnableCaching
public class Springboot3Application {
	private static final Logger logger = LoggerFactory.getLogger(Springboot3Application.class);
	public static void main(String[] args) throws UnknownHostException {
		ConfigurableApplicationContext run = SpringApplication.run(Springboot3Application.class, args);
		Environment env = run.getEnvironment();
		logger.info("\n----------------------------------------------------------\n\t" +
						"Application '{}' is running! Access URLs:\n\t" +
						"External: \thttp://{}:{}\n\t" +
						"Swagger: \thttp://{}:{}{}/swagger-ui/swagger-ui/index.html\n\t" +
						"knife4j: \thttp://{}:{}{}/doc.html\n",
				env.getProperty("spring.application.name"),
				InetAddress.getLocalHost().getHostAddress(),
				env.getProperty("server.port"),
				InetAddress.getLocalHost().getHostAddress(),
				env.getProperty("server.port"),
				env.getProperty("server.servlet.context-path"),
				InetAddress.getLocalHost().getHostAddress(),
				env.getProperty("server.port"),
				env.getProperty("server.servlet.context-path"));

	}

}
